<!--
 * @Author: Wayne 13235388225@163.com
 * @Date: 2023-10-12 14:06:18
 * @LastEditors: Wayne 13235388225@163.com
 * @LastEditTime: 2023-10-13 09:05:42
 * @FilePath: \Jkc-app-front-new\src\views\withdrawalApplication\withdrawalRecord.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="app-container">
    <div class="view-title">提现记录</div>
    <el-table
      :data="recordTableData"
      v-loading="loading"
      element-loading-text="正在加载中"
      :header-cell-style="{
        borderColor: '#F0F0F0',
        height: '51px',
        background: '#F0F0F0',
        color: '#333',
      }"
      :row-style="{ height: '51px' }"
      :cell-style="{ borderColor: '#F0F0F0' }"
      style="width: 100%; margin-top: 20px"
    >
      <el-table-column
        prop="app_user"
        label="用户昵称"
        width="180"
        align="center"
      >
        <template slot-scope="scope">{{
          scope.row.app_user ? scope.row.app_user.nick : ""
        }}</template>
      </el-table-column>
      <el-table-column prop="user_id" label="用户id" width="180" align="center">
      </el-table-column>
      <el-table-column
        prop="balance"
        label="提现金额"
        align="center"
      ></el-table-column>
      <!--          <el-table-column prop="status" label="提现状态" align="center">-->
      <!--            <template slot-scope="scope">-->
      <!--              <span v-if="scope.row.status == 0">审核中</span>-->
      <!--              <span v-else-if="scope.row.status == 1">审核成功</span>-->
      <!--              <span v-else-if="scope.row.status == 2">审核失败</span>-->
      <!--            </template>-->
      <!--          </el-table-column>-->

      <!--          <el-table-column prop="type" label="提现方式" align="center">-->
      <!--            <template slot-scope="scope">-->
      <!--              <span v-if="scope.row.type == 2">支付宝</span>-->
      <!--              <span v-else-if="scope.row.type == 3">微信</span>-->
      <!--              <span v-else-if="scope.row.type == 4">银联</span>-->
      <!--            </template>-->
      <!--          </el-table-column>-->
      <el-table-column prop="created_at" label="创建时间" align="center">
      </el-table-column>
      <el-table-column prop="updated_at" label="更新时间" align="center">
      </el-table-column>
    </el-table>

    <div class="page_box">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNow"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { getAppGetpayRecordList } from "@/api/withdrawalApplication.js";
import { getAppUserBalanceRecordList } from "@/api/balanceRecord.js";

import checkPermission from "@/utils/permission"; // 权限判断函数

export default {
  data() {
    return {
      pageNow: 1,
      pageSize: 10,
      total: null,
      recordTableData: [],
      loading: true,
    };
  },
  mounted() {
    this.getAppUserBalanceRecordList();
  },
  methods: {
    checkPermission,
    // 查询全部余额记录
    getAppUserBalanceRecordList() {
      getAppUserBalanceRecordList({
        source: "5",
        page_size: this.pageSize,
        page_now: this.pageNow,
      }).then((res) => {
        if (res.code == 1) {
          this.loading = false;
          this.recordTableData = res.data;
          this.total = res.page_info.total_count;
        } else {
          this.loading = false;
          this.$message.error(res.msg);
          return;
        }
      });
    },

    handleSizeChange(val) {
      this.pageSize = val;
      this.pageNow = 1;
      this.getAppUserBalanceRecordList();
    },
    handleCurrentChange(val) {
      this.pageSize = 10;
      this.pageNow = val;
      this.getAppUserBalanceRecordList();
    },

    // 查询全部提现记录
    // getAppGetpayRecordList() {
    //   getAppGetpayRecordList({
    //     page_now: this.pageNow,
    //     page_size: this.pageSize
    //   }).then((res) => {
    //     if (res.code == 1) {
    //       this.loading = false
    //       this.recordTableData = res.data
    //     } else {
    //       this.loading = false
    //       this.$message.error(res.msg)
    //       return
    //     }
    //   })
    // }
  },
};
</script>
<style lang="scss" scoped>
.withdrawal_record_container {
  padding: 20px 30px;

  .withdrawal_record_box {
    .page_box {
      display: flex;
      justify-content: center;
      padding: 20px 0;
    }
  }
}
</style>
